
export function add0(m){return m<10?'0'+m:m }
export function get_shijian(shijianchuo,t){
    //shijianchuo是整数，否则要parseInt转换
    if(!shijianchuo){
        return '';
    }
    if(shijianchuo==0){
        return '';
    }
    var time = new Date(parseInt(shijianchuo)*1000);
    var y = time.getFullYear();
    var m = time.getMonth()+1;
    var d = time.getDate();
    var h = time.getHours();
    var mm = time.getMinutes();
    var s = time.getSeconds();
    if(t=='ymdhis'){
        return y+'-'+add0(m)+'-'+add0(d)+' '+add0(h)+':'+add0(mm)+':'+add0(s);
    }
    if(t=='ymd'){
        return y+'-'+add0(m)+'-'+add0(d);
    }
    if(t=='his'){
        return add0(h)+':'+add0(mm)+':'+add0(s);
    }
    if(t=='mdhi'){
        return add0(m)+'-'+add0(d)+' '+add0(h)+':'+add0(mm);
    }

    
    return y+'-'+add0(m)+'-'+add0(d)+' '+add0(h)+':'+add0(mm);
    
    
}